package com.hzcx.app.simplechat.ui.setting.adapter;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.hzcx.app.simplechat.R;
import com.hzcx.app.simplechat.util.empty.EmptyUtils;
import com.hzcx.app.simplechat.util.glide.GlideUtils;

import java.util.List;

public class ImgAdapter extends BaseQuickAdapter<String, BaseViewHolder> {
    public ImgAdapter(int layoutResId, @Nullable List<String> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, String item) {
        if (EmptyUtils.isEmpty(item)) {
            helper.setImageResource(R.id.iv_img, R.mipmap.ic_icon_img_default);
            helper.setVisible(R.id.iv_delete, false);
        } else {
            GlideUtils.loadImgAsCenter(mContext, item, helper.getView(R.id.iv_img));
            helper.setVisible(R.id.iv_delete, true);
        }
        helper.addOnClickListener(R.id.iv_delete);
    }
}
